package com.taiyuan.zfmvp.ExportExcel;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @param request
 * @Author: zhoufang@si-tech.com.cn
 * @Descriiption:
 * @Date 2021/11/20
 * @return
 */
@RestController
public class testExcel {



        /**
         * @Author zhoufang@si-tech.com.cn
         * @Description  测试导出excel
         * @Date 2021/11/20
         * @Param
         * @Return
         */
        @GetMapping("/excel/exportData")
        public String exportExcel(HttpServletResponse response){
            String filePath = "/home/chenmingjian/Downloads/测试.xlsx";
            List<List<Object>> data = new ArrayList<>();
            data.add(Arrays.asList("111","222","333"));
            data.add(Arrays.asList("111","222","333"));
            data.add(Arrays.asList("111","222","333"));
            List<String> head = Arrays.asList("表头1", "表头2", "表头3");
            ExcelUtil.writeBySimple(response,filePath,data,head);
            return "0";
        }


}
